<template>
  <view class="content">
    <u-cell-group title-bg-color="rgb(243, 244, 246)">
      <button class="shareBtn" v-for="(item, index) in indexList" :open-type="item.id==0?'share':''"
              @click="showToast(item)">
        <u-cell :titleStyle="{fontWeight: 500}" :title="item.text" :key="index" isLink :icon="item.icon"></u-cell>
      </button>
    </u-cell-group>
    <u-popup
        :safeAreaInsetBottom="true"
        :safeAreaInsetTop="true"
        :borderRadius="popupData.borderRadius"
        :show="indexList[3].show"
        @close="indexList[3].show=false"
        :closeable="true"
        mode="bottom">
      <view
          class="u-popup-slot"
          :style="{
					width: '750rpx',
					marginTop: '10rpx'
				}"
      >
        <u-button
            style="margin: 0 auto"
            type="success"
            text="确认退出"
            customStyle="width: 200rpx"
            @click="logout();indexList[3].show=false"
        ></u-button>
      </view>
    </u-popup>
  </view>
</template>

<script>
import {
  mapMutations,
  mapGetters
} from 'vuex'

export default {
  name: "functionList",
  data() {
    return {
      indexList: [
        {
          id: "0",
          text: "邀请好友",
          icon: "weixin-fill"
        },
        {
          id: "1",
          text: "开源地址",
          icon: "attach"
        },
        {
          id: "2",
          text: "技术帮助",
          icon: "setting"
        },
        {
          id: "3",
          text: "退出登录",
          icon: "close",
          show: false
        }
      ]
    }
  },

  computed: {},
  methods: {
    ...mapMutations(['setUserInfo','logout']),

    //列表激活
    showToast(item) {
      if (item.id == '1') {
        //开源地址
        uni.$u.toast("https://gitee.com/hejialun")
      }
      if (item.id == '2') {
        //技术帮助
        uni.$u.toast("联系QQ:1173089798；备注来意")
      }
      if (item.id == '3') {
        this.indexList[3].show=true;

      }
    },




  }
}
</script>

<style lang="scss">
.content {
  width: 100%;
  background: #ffffff;
  border-radius: 20rpx;

  .shareBtn::after {
    border: none;
  }

  .shareBtn {
    width: 100%;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
    background-color: #ffffff;
    border-radius: 0;
  }
}
</style>
